
import React, { Component } from 'react';
import {
    View,
    Text,
    Image,
    TouchableOpacity,
} from 'react-native';

import { positionfiveStyle as styles } from '../../../../../styles';
import sal from '../../../../util/sal';
import fmt from '../../../../util/fmtDateUtil';
import {common_url} from "../../../../util/fetch";

var Dimensions = require('Dimensions');
var { width, height } = Dimensions.get('window');  //获取屏幕的宽和高

export default class PosFive_a extends Component {

    constructor(props) {
        super(props);
    }

    render() {
        if (this.props.plists.company == undefined) {
            return (
                <TouchableOpacity
                    style={styles.posallin}
                    activeOpacity={1}
                >
                    <Image source={require('../../../../img/home/xiaomi.png')} style={styles.head} />
                    <View style={[styles.sevenline, { width: width * 0.7 }]}>
                        <View style={styles.seven1}>
                            <Text style={styles.fivepoz}>Java高级工程师</Text>
                            <Text style={styles.fivemoney}>6k-8k</Text>
                        </View>
                        <View style={styles.seven2}>
                            <Text style={styles.fivename}>沈阳先知蓝创科技有限公司</Text>
                            <Text style={styles.fivetime}>07:58</Text>
                        </View>
                        <View style={styles.seven3}>
                            <Text style={styles.fivenon}>沈阳</Text>
                            <Text style={styles.fivenon}>3-5年</Text>
                            <Text style={styles.fivenon}>本科</Text>
                        </View>
                    </View>
                </TouchableOpacity>
            )
        } else {
            return (
                <TouchableOpacity
                    style={styles.posallin}
                    onPress={() => { this.goGet('Postionin', this.props.plists.postionId); }}
                    activeOpacity={1}
                >
                    <Image source={
                        this.props.plists.company.companyPicture ?
                            {uri: common_url + "uploadImg/" + this.props.plists.company.companyPicture}
                            : require('../../../../img/app/company.png')} 
                            style={[styles.head,{width:width*0.13,height:width*0.13,marginRight:width*0.03}]} />
                    <View style={[styles.sevenline, { width: width * 0.68 }]}>
                        <View style={styles.seven1}>
                            <Text style={styles.fivepoz}>{this.props.plists.postionName}</Text>
                            <Text style={styles.fivemoney}>{sal(this.props.plists.postionMm, this.props.plists.postionYm)}</Text>
                        </View>
                        <View style={styles.seven2}>
                            <Text style={styles.fivename}>{this.props.plists.company.companyName}</Text>
                            <Text style={styles.fivetime}>{fmt(this.props.plists.postionTime, "yyyy-MM-dd")}</Text>
                        </View>
                        <View style={styles.seven3}>
                            <Text style={styles.fivenon}>{this.props.plists.postionSpace}</Text>
                            <Text style={styles.fivenon}>{this.props.plists.postionExp}年经验</Text>
                            <Text style={styles.fivenon}>{this.props.plists.postionEducation}</Text>
                        </View>
                    </View>
                </TouchableOpacity>
            )
        }
    }
    goGet(name, id) {
        this.props.navigation.navigate(name, { useId: id });
    }
}